{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">游戏房间</li>
            <li class=""><a href="{:url('admin/room/add')}">添加房间</a></li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

                <!--<form class="layui-form layui-form-pane" action="{:url('admin/agent/index')}" method="get">-->
                    <!--<div class="layui-inline">-->
                        <!--<label class="layui-form-label">关键词</label>-->
                        <!--<div class="layui-input-inline">-->
                            <!--<input type="text" name="keyword" value="{$keyword}" placeholder="请输入关键词" class="layui-input">-->
                        <!--</div>-->
                    <!--</div>-->
                    <!--<div class="layui-inline">-->
                        <!--<button class="layui-btn">搜索</button>-->
                    <!--</div>-->
                <!--</form>-->
                <hr>

                <table class="layui-table" style="text-align: center">
                    <thead>
                    <tr>
                        <th style="width: 30px;">ID</th>
                        <th>房间UUID</th>
                        <th>房间名称</th>
                        <th>创建者</th>
                        <th>创建时间</th>
                        <th>房间状态</th>
                        <th>机器人</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="room_list" item="vo"}
                    <tr>
                        <td>{$vo.room_id}</td>
                        <td>{$vo.room_uuid}</td>

                        <td>{$vo.room_name}</td>
                        <td>{$vo.create_username}</td>
                        <td>{$vo.create_time}</td>
                        <td>{php}echo $vo['status'] == 1 ? '开启' : '关闭'{/php}</td>
                        <td><a class="layui-btn layui-btn-mini" href="{:url('admin/room/robot',['id' => $vo['room_id']])}">管理机器人</a></td>
                        <td>
                            <a href="{:url('admin/room/edit',['id'=>$vo['room_id']])}" class="layui-btn layui-btn-info layui-btn-mini">编辑</a>
                            <a href="{:url('admin/room/change',['id'=>$vo['room_id'],'status' => $vo['status']])}" class="layui-btn {if condition="$vo.status == 1"} layui-btn-danger {elseif condition="$vo.status==0"} {/if} layui-btn-mini ajax-delete" {if condition="$vo.status == 1"}data-msg="确认关闭房间吗？"{elseif condition="$vo.status == 0"} data-msg="确认开启房间吗？" {/if}>{if condition="$vo.status == 1"}关闭{elseif condition="$vo.status==0"}开启{/if}</a>
                            <a href="{:url('admin/room/delete',['id'=>$vo['room_id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                <!--分页-->
                {$room_list->render()}
            </div>
        </div>
    </div>
</div>
{/block}